home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 4 / BBS in a Box - Macintosh - Volume IV (January 1992) (BBS in a Box).iso / Files / Prog / A / Alpha.4.01.cpt / Alpha.4.01.rsrc / STR#_133.txt < prev    next >
Encoding:
Text File  |  1991-10-22  |  4.1 KB  |  227 lines

  1. Defining and Using Macros
  2.  
  3. ALPHA supports keyboard macros which record a sequence
  4.  
  5. of keystrokes to be played back later w/ the function
  6.  
  7. 'executeKeyboardMacro' (this function is also in the
  8.  
  9. 'Utilities' menu) or written into a buffer by selecting
  10.  
  11. 'Dump Function' from the 'Utilities' menu. The dump
  12.  
  13. function prompts you for a macro name, which must
  14.  
  15. consist only of letters of the alphabet, digits, and
  16.  
  17. '_'.
  18.  
  19. 
  20.  
  21. These macro declarations can then be edited, loaded, and
  22.  
  23. bound to keystrokes. Loading a macro or a binding is
  24.  
  25. accomplished by hiliting the text and selecting the
  26.  
  27. "Load Selection" item of the 'Customize' window. If no
  28.  
  29. text is hilited, the entire window is loaded by the same
  30.  
  31. command. Macros can be bound to keys in exactly the same
  32.  
  33. manner as functions (see above).
  34.  
  35. 
  36.  
  37. Macros lines can be as simple as the name of a function
  38.  
  39. or previously defined function. Macros can set
  40.  
  41. variables. The functions 'saveVars' and 'restoreVars'
  42.  
  43. have been provided to let macros leave the environment
  44.  
  45. in the same state that they found it. The keyword "type"
  46.  
  47. has been provided to
  48.  
  49. enter text. One good way to learn to write macros is to
  50.  
  51. record a macro and dump it to a file. Play w/ it, change
  52.  
  53. things around, add functions, and reload it. If you want
  54.  
  55. to keep it, just put it in the 'AlphaBits' file. Several
  56.  
  57. example macros have been provided in the 'AlphaBits'
  58.  
  59. file.
  60.  
  61. 
  62.  
  63. Several commands which prompt for input actually compile
  64.  
  65. the result of the prompt into the macro, as opposed to
  66.  
  67. again prompting every time the macro is executed. These
  68.  
  69. commands include the search and replace commands, 'ACMD'
  70.  
  71. calls, and setting named marks and clipboards. To see
  72.  
  73. what is compiled in these cases, try creating such a
  74.  
  75. macro and dumping it to a buffer.
  76.  
  77. 
  78.  
  79. The following are commands that can only be executed
  80.  
  81. from macros, see the distributed 'AlphaBits' file for
  82.  
  83. examples of use and syntax.
  84.  
  85. 
  86.  
  87. ‚Ä¢ acmd "name" - execute named acmd, which must be in the
  88.  
  89.   resource fork of Alpha
  90.  
  91. ‚Ä¢ clipsearch "name" - search for contents of named
  92.  
  93.   clipboard
  94.  
  95. ‚Ä¢ copyclip "name" - copy selected text to named
  96.  
  97.   clipboard
  98.  
  99. ‚Ä¢ cutclip "name" - cut selected text to named clipboard
  100.  
  101. ‚Ä¢ define - used to name macro
  102.  
  103. ‚Ä¢ deleteclip "name" - delete named clipboard
  104.  
  105. ‚Ä¢ deletemark "name" - delete named mark
  106.  
  107. ‚Ä¢ deletemenu "name" - remove menu from menubar
  108.  
  109. ‚Ä¢ fileSet - used to define file sets
  110.  
  111. ‚Ä¢ goto "name" - goto named mark
  112.  
  113. ‚Ä¢ insertmenu "name" - insert menu into menubar
  114.  
  115. ‚Ä¢ mark "name" - create named mark
  116.  
  117. ‚Ä¢ menu - used to instantiate the user menu
  118.  
  119. ‚Ä¢ message "<the message>" - puts a message on status
  120.  
  121.   line.
  122.  
  123. ‚Ä¢ loadfile "<complete pathname>" - loads file.
  124.  
  125. ‚Ä¢ openfile "<complete pathname>" - opens file.
  126.  
  127. ‚Ä¢ prompt "<prompt str>" "<clip for result>" - prompts.
  128.  
  129.   the user and puts the result in the named clipboard.
  130.  
  131. ‚Ä¢ putascii <ascii code> - can be used for 8-bit
  132.  
  133.   characters. The use of flex currently prevents the use
  134.  
  135.   of 8-bit characters in any direct form in the
  136.  
  137.   AlphaBits file.
  138.  
  139. ‚Ä¢ replace "name" - replace selection
  140.  
  141. ‚Ä¢ replaceFindAgain "name" - replace and find again
  142.  
  143. ‚Ä¢ restoreVars - restore all numeric vars to saved
  144.  
  145.   values, re-entrant
  146.  
  147. ‚Ä¢ saveVars - save all numeric vars, re-entrant
  148.  
  149. ‚Ä¢ search "name" - search for string, based on current
  150.  
  151.   flag values
  152.  
  153. ‚Ä¢ set - used to set variable contents (mirrors command
  154.  
  155.   that works outside macros as well
  156.  
  157. ‚Ä¢ type "name" - inserts string into current window.
  158.  
  159.   '\r' means carriage return, '\t' means tab.
  160.  
  161. ‚Ä¢ yankclip "name" - yank from named clipboard
  162.  
  163. 
  164.  
  165. In addition, all three forms of bindings and unbindings
  166.  
  167. can be placed in macros, with the exact same format as
  168.  
  169. when they are used outside of macros, parenthesis and
  170.  
  171. all.
  172.  
  173. 
  174.  
  175. 
  176.  
  177. Undo and Redo
  178.  
  179. 
  180.  
  181. ALPHA supports unlimited undo and redo. This means that
  182.  
  183. most changes can be undone, and then redone, at will.
  184.  
  185. Bear in mind that once you create new modifications, all
  186.  
  187. changes that you have undone but not redone are lost.
  188.  
  189. Another point to bear in mind is that saving a buffer to
  190.  
  191. disk currently flushes the undo buffer.
  192.  
  193. 
  194.  
  195. 
  196.  
  197. 
  198.  
  199. 
  200.  
  201. 
  202.  
  203. 
  204.  
  205. 
  206.  
  207. 
  208.  
  209. 
  210.  
  211. 
  212.  
  213. 
  214.  
  215. 
  216.  
  217. 
  218.  
  219. 
  220.  
  221. 
  222.  
  223. 
  224.  
  225. 
  226.  
  227.